home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v10n17.arc / TITLEBAR < prev    next >
Text File  |  1991-09-25  |  1KB  |  29 lines

  1. REM Titlebar
  2.  
  3. ' declare four Windows API calls (all from USER module) that we'll use
  4. Declare Sub GetWindowText Lib "user" \
  5.     (hWnd As Integer, lpString$, nMaxCount As Integer)
  6. Declare Sub SetWindowText Lib "user" \
  7.     (hWnd As Integer, lpString$)
  8. Declare Sub SendMessage Lib "user" \
  9.     (hWnd As Integer, wMsg As Integer, wParam As Integer, lParam$)
  10. Declare Function GetActiveWindow Lib "user"() As Integer
  11.  
  12. Sub MAIN
  13.     hwnd = GetActiveWindow          ' find WinWord's window handle
  14.     save$ = String$(128, " ")       ' allocate a string to hold title bar
  15.     GetWindowText hwnd, save$, 128  ' get the title bar into the string
  16.     Print save$
  17.     SetWindowText hwnd, "this is a test"   ' change the title bar
  18.     MsgBox "Look at the title bar"  ' tell user to examine the change
  19.     SetWindowText hwnd, save$       ' set it back to original
  20.     AppMinimize                     ' make WinWord iconic
  21.     wmSetText = 12                  ' WM_SETTEXT message
  22.     For i = 0 To 100
  23.         ' SendMessage wmSetText is equivalent to SetWindowText
  24.         SendMessage hwnd, wmSetText, 0, "test #" + Str$(i)
  25.     Next i
  26.     AppRestore                      ' restore WinWord from iconic state
  27.     SetWindowText hwnd, save$       ' restore title bar to original
  28. End Sub
  29.